package springdb.springdb.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import springdb.springdb.bean.Employee;
import springdb.springdb.mapper.EmployeeMapper;

/**
 * @Auther: luzhanshi
 * @Date: 2021/3/6 - 03 - 06 - 8:43 
 * @Description: springdb.springdb.controller
 * @version: 1.0
 */
@RestController
public class EmpController {

    @Autowired
    EmployeeMapper employeeMapper;

    @GetMapping("/emp/{id}")
    public Employee getEmpById(@PathVariable(name = "id") int id) {
        return employeeMapper.getEmpById(id);
    }

    @GetMapping("/emp")
    public Employee insertEmp(Employee employee) {
         employeeMapper.insertEmp(employee);
         return employee;
    }

}
